import pika

credentials = pika.PlainCredentials("guest", "guest")
conn_params = pika.ConnectionParameters("localhost",credentials=credentials)
conn_broker = pika.BlockingConnection(conn_params)
channel = conn_broker.channel()

channel.exchange_declare(exchange="internal-exchange", 
                         exchange_type="fanout",
                         passive=False,
                         durable=False,
                         internal=True,
                         auto_delete=False)

channel.exchange_declare(exchange="exchange1",
                         exchange_type="direct",
                         passive=False,
                         durable=False,
                         internal=False,
                         auto_delete=False)

channel.exchange_bind(destination="internal-exchange",source="exchange1",routing_key="internal")
channel.queue_declare(queue="internal-queue")
channel.queue_bind(queue="internal-queue",exchange="internal-exchange")

channel.basic_publish(body="message",
                      exchange="exchange1",
                      routing_key="internal")

